/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package uimigration.mappingmodel.impl;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EDataType;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;

import org.eclipse.emf.ecore.impl.EFactoryImpl;

import org.eclipse.emf.ecore.plugin.EcorePlugin;

import uimigration.mappingmodel.*;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Factory</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class MappingmodelFactoryImpl extends EFactoryImpl implements
		MappingmodelFactory {
	/**
	 * Creates the default factory implementation.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public static MappingmodelFactory init() {
		try {
			MappingmodelFactory theMappingmodelFactory = (MappingmodelFactory)EPackage.Registry.INSTANCE.getEFactory("http://mappingmodel/1.0"); 
			if (theMappingmodelFactory != null) {
				return theMappingmodelFactory;
			}
		}
		catch (Exception exception) {
			EcorePlugin.INSTANCE.log(exception);
		}
		return new MappingmodelFactoryImpl();
	}

	/**
	 * Creates an instance of the factory.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingmodelFactoryImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public EObject create(EClass eClass) {
		switch (eClass.getClassifierID()) {
			case MappingmodelPackage.MAPPING_TABLE: return createMappingTable();
			case MappingmodelPackage.MAPPING_ACTION_EVENT: return createMappingActionEvent();
			case MappingmodelPackage.MAPPING_BEHAVIOUR_EVENT: return createMappingBehaviourEvent();
			case MappingmodelPackage.MAPPING_POSITION_PROPERTIES: return createMappingPositionProperties();
			case MappingmodelPackage.EVENT: return createEvent();
			case MappingmodelPackage.WIDGET_EVENT: return createWidgetEvent();
			default:
				throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object createFromString(EDataType eDataType, String initialValue) {
		switch (eDataType.getClassifierID()) {
			case MappingmodelPackage.ACTION_TYPE:
				return createActionTypeFromString(eDataType, initialValue);
			case MappingmodelPackage.BEHAVIOUR_TYPE:
				return createBehaviourTypeFromString(eDataType, initialValue);
			case MappingmodelPackage.POSITION_TYPE:
				return createPositionTypeFromString(eDataType, initialValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public String convertToString(EDataType eDataType, Object instanceValue) {
		switch (eDataType.getClassifierID()) {
			case MappingmodelPackage.ACTION_TYPE:
				return convertActionTypeToString(eDataType, instanceValue);
			case MappingmodelPackage.BEHAVIOUR_TYPE:
				return convertBehaviourTypeToString(eDataType, instanceValue);
			case MappingmodelPackage.POSITION_TYPE:
				return convertPositionTypeToString(eDataType, instanceValue);
			default:
				throw new IllegalArgumentException("The datatype '" + eDataType.getName() + "' is not a valid classifier");
		}
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingTable createMappingTable() {
		MappingTableImpl mappingTable = new MappingTableImpl();
		return mappingTable;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingActionEvent createMappingActionEvent() {
		MappingActionEventImpl mappingActionEvent = new MappingActionEventImpl();
		return mappingActionEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingBehaviourEvent createMappingBehaviourEvent() {
		MappingBehaviourEventImpl mappingBehaviourEvent = new MappingBehaviourEventImpl();
		return mappingBehaviourEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingPositionProperties createMappingPositionProperties() {
		MappingPositionPropertiesImpl mappingPositionProperties = new MappingPositionPropertiesImpl();
		return mappingPositionProperties;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Event createEvent() {
		EventImpl event = new EventImpl();
		return event;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public WidgetEvent createWidgetEvent() {
		WidgetEventImpl widgetEvent = new WidgetEventImpl();
		return widgetEvent;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public ActionType createActionTypeFromString(EDataType eDataType,
			String initialValue) {
		ActionType result = ActionType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertActionTypeToString(EDataType eDataType,
			Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public BehaviourType createBehaviourTypeFromString(EDataType eDataType,
			String initialValue) {
		BehaviourType result = BehaviourType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertBehaviourTypeToString(EDataType eDataType,
			Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public PositionType createPositionTypeFromString(EDataType eDataType,
			String initialValue) {
		PositionType result = PositionType.get(initialValue);
		if (result == null) throw new IllegalArgumentException("The value '" + initialValue + "' is not a valid enumerator of '" + eDataType.getName() + "'");
		return result;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public String convertPositionTypeToString(EDataType eDataType,
			Object instanceValue) {
		return instanceValue == null ? null : instanceValue.toString();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public MappingmodelPackage getMappingmodelPackage() {
		return (MappingmodelPackage)getEPackage();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @deprecated
	 * @generated
	 */
	@Deprecated
	public static MappingmodelPackage getPackage() {
		return MappingmodelPackage.eINSTANCE;
	}

} //MappingmodelFactoryImpl
